home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
network
/
serial
/
termpkg.rea
< prev
next >
Wrap
Text File
|
1996-11-17
|
11KB
|
238 lines
These are crude operational docs for sure, but they should give you a basic
understanding of how to use both termnet and termsrvd.
The purpose of these programs was to emulate a terminal server. Termnet is
the client through which you the user communicates with the serial devices
with like you would use telnet, and termsrvd is the server program that
provides the actual connection to the serial device. By using a subset of the
telnet protocol w/ a few special extensions allowing the port, bad rate and
port parameters to be set, gives the user a convenient terminal program
providing access to the serial ports on any machine that is running the
termsrvd program.
Just as termnet can be used to talk to any telnet service, telnet can also
be used to connect to termsrvd, though the special port configuration options
will not work in either of these situations. To alleviate this problem to
some degree, termsrvd can be configured through the file /etc/services and
/etc/inetd.conf to allow it to be started w/ fixed port assignments and
configurations.
Okay, now on to the options used by the programs. It is my hope to one day
change termsrvd's options to conform to termnet's options. This will help in
remembering them considerably.
termsrvd:
termsrvd [options]
-p <settings> // Set port default port configuration
-b <baud rate> // Set default baud rate
-d <device> // Set default initial device
The port settings is a string composed of the following characters
N // No parity (default)
E // Even parity
O // Odd parity
8 // 8 bits / word (default)
7 // 7 bits / word
6 // 6 bits / word
5 // 5 bits / word
1 // 1 stop bit (default)
2 // 2 stop bits
H // Half Duplex
F // Full Duplex (default)
S[01] // S/W Flow control (off/on) (default = on)
C[01] // H/W Flow control (off/on) (default = off)
For example, -s 7EH2C1S0 will set up the port configuration as 7 bits,
Even parity, 2 stop bits, Full duplex, and Hardware flow control on.
The entire set does not have to be specified, any option not given
will remain unchanged.
Baud rate can be any of the following baud rates assuming both the
hardware and the machines OS will allow them. I'm not sure of the
commend, but fro my understanding, Unix will only allow a maximum
baud rate of 9600 though there is a command that can be run to set
it to a maximum of 38400.
300
600
1200
2400
4800
9600
19200
38400
Device is the full name of the device to initialy connect to such
as /dev/cua0.
termnet:
termnet [options] [<host> [<port>]] [chat like sequences]
If not provided, termnet will attempt to connect to 'localhost' on
port 'termsrvd'.
-e // Echo localy
-d <device> // Initial device
-p <settings> // Initial port configuration
-b <baudrate> // Initial baudrate
-f <script file> // Run a Chat like script file
-c // Continue to execute after the script
is exausted
All of the options except -r -l -f & -c take parameters in the form
described above for termsrvd.
The chat sequences mentioned above follow the sequence of <send string>
<expect string>. If they are placed on the command line, each argument found
after the options and the host/port will be considered as individual strings
spaces my be included, though care should be excersized because of the way
the shell will interpret the strings before it gives them to the program!
Using a file with then -f option not only protects you from the interaction
of the shell but also provides the added functionality of being able to
execute any of the commands termnet provides. They can be interjected
anywhere in the script using the sequence "`<command string>`". Please note
the use of the ` character, it is what tells the interpreter that the
sequence is a command. The use of single or double quotes to demark the
each string (except the command strings) are highly recommended. The '\'
character is used to put special characters into the string. The following
is a list of allowable escape sequences:
\r // Carriage return
\n // Line feed
\e // Escape character
\t // Tab character
\x<number> // Send hex number as a character
\0<number> // Send Octal number as a character
\[1-9]<number> // Send Decimal number as a character
\<character> // Send <character> w/ out interpreting it
All of the above except the \e and the \t may also be used in the command
line sequences.
The one MAJOR thing that needs to be remembered when using either form of
the chat sequences is that the program will be exited at the end of the
sequence unless the -c option is present on the command line.
Also, please remember that the keyboard is fully functional while the
sequences are running, this allows you to intervene in cases where things
don't go as your chat script expects. I have found this to be most useful,
though you do need to be careful not type anything in as it will be sent
to the other end!
The command interpreter of termnet can be accessed w/ by typing a ^]
character. Unfortunately this character cannot be changed at this point. The
following commands can be given.
Echo on // Echo localy
Echo off // Disable Echo
Echo arg arg ... // Echo args to stdout
Pause <time> // Pause <time> seconds
Help // Display Available Commands
Baud [<buad rate>] // set/display baud rate
Port [<settings>] // set/display port settings
Devc [<device>] // set/display device
Pause <seconds> // Pause for <seconds> in time
Exit // Exit the program
Quit // Exit the program
$ <command> [<args>] // Execute a command w/ its standard i/o
// redirected to the serial device
! <command> [<args>] // Execute a command, this IS BROKEN!!!!
The commands Baud, port, and devc will display the current setting of that
item from the server. These commands are only functional if termnet is
connected to termsrvd and not a telnet server. Also, if the special keyword
'Select' is given for the device when using the devc command, you will be
stepped through the devices that termsrvd has been configured for through
the file /etc/termsrvd.conf.
Configuration files:
/etc/inetd.conf
/etc/services
/etc/termsrd.conf
The file /usr/var/adm/termsrvd.log may be generated, I'll be honest, I'm not
sure, but if it is you will want to keep an eye on it as it can eat up alot
diskspace as time goes on. Hmmm... I probably should check mine!!!
The /etc/termsrvd.conf file consists of one line enties w/ the following
format:
<Name>:<Device>:[<Baud>]:[<Port Settings>]
<Name> Reference name (Required)
<Device> Fully Qualified Device name (Required)
<Baud> Baud rate (Optional)
<Port Settings> Bits, Parity, etc. (Optional)
Baud and Port Settings are expressed in a like manner as for the
options. Each device to be accessed must have an entry in the table. A
device may have multiple entries in the file each with a different
reference name. If the device is chosen through the DEVC command using
the actual device name, than the baud and port settings will remain as
they were. The file termsrvd.conf.eg shows examples of how various
configurations can look.
I use the example script file to connect to my computer at work over the X.25
network to wake it up and have it call me back to initiate a PPP link to
home. It works great as long as as all of the connections go as expected. Mind
you though, I had to replace the actuall X.25 network number and all of the
usernames and passwords as my Boss has made it quiet clear just how high the
tree is that he would personaly hang me from if I gave out any of that
information. It should still work out well as an example of how to do a
script file though. To use it I would use the following command:
termnet -d /dev/cua1 -f connect-work
In case it's not inuitive, it starts by setting the port parms to
7 bits, even parity, one stop bit. It then dials up the X.25 network
after getting carrier, it sends an '@D' and waits for 'TERMINAL'
it then sends a carriage return and waits for the prompt '@' at which
time it connects to the computer at work, it then changes the port settings
to 8 bits no parity then logs in, and telnets over to my machine and logs
in as a special user that will cause my machine to wake up in a minute or so
later and call my computer at home back. After seeing the '+++' I know that
it will be calling me back soon so I put the port settings back to 7E1 and
forces the modem to hang up. After that I just have to wait for my computer
call me back and log in as a user that starts up the pppd daemon.
Now hopefully between the above and the example files given you will be able
to make good use of these programs. I have been using them regularly for
almost a year now w/ only minimal problems. Though I CAN NOT BE HELD
RESPONSIBLE FOR ANY DAMAGES THAT MAY ARISE FROM THE USE OF THESE PROGRAMS!!!!
This even includes the blowing up of your Network, and Computer. BE SURE NOT
TO OVERWRITE THE /etc/inetd.conf and /etc/services WITH THE EXAMPLES FILES
PROVIDED, THIS WILL SURELY HURT!!!! Use the example files as examples as to
what is needed to be included in your ALREADY EXISTING FILES!!!!! With that
said, good luck and enjoy! If you have any problems or find any bugs, you can
email me at jcroft@unicomp.net. Not that any of my code has bugs, heheh.
I also will not turn down any donations. Being that I like many others in
the world is but a humble indentured servent living hand to mouth will always
appreciate any additional income that arises from my play. Though please keep
mind that at $25.00 a pop, bad checks do much more harm than good!
Joe Croft
225 Arthur Rd.
Hurst, Tx., 76053
jcroft@unicomp.net
Oh, I forgot to mention, if you take the time to look at the libtn directory,
and how it is used in the two programs, you will find a very versitile
library for creating telnet applications, though it still needs some work on
it as it's DO/DONT WILL/WONT processing is uh... single ended. In otherwords,
it does not keep track of each side's abilities and desires.
I have found through playing that termsrvd has trouble with the first
entry in the termsrvd.conf file. It shows up most when you have the entry
specify a baud rate and port settings that differ from the defaults then
use termnet w/o specifying device. Not sure of the cause but it doesn't
seem to break the program. I will look into it and by the next release it
will be fixed. If any off Yall happen to find what the problem is before
I, please email me!